package cn.xaut.春招2021;

/**
 * 172. 阶乘后的零
 */
public class demo172 {

    public int trailingZeroes(int n) {

        int sum = 1;
        for (int i = 1; i <= n; i++)
            sum *= i;
        System.out.println(sum);
        int res = 0;
        while (sum != 0 && sum % 10 == 0) {
            res++;
            sum /= 10;
        }
        return res;
    }

    public static void main(String[] args) {

        System.out.println(new demo172().trailingZeroes(3));
        System.out.println(new demo172().trailingZeroes(5));
        System.out.println(new demo172().trailingZeroes(7));
        System.out.println(new demo172().trailingZeroes(13));
    }
}
